@extends('Layout/adminBase')
@section('css')
<link rel="stylesheet" type="text/css" href="{{asset('/bootstrap/css/bootstrap.min.css')}}">
<style type="text/css">
    tr{
        text-align: center;
    }
    tr th{
         text-align: center;
    }
</style>
@endsection
@section('body')
<div class='container'>
    <div class="head-list">
        <form class="form-inline search" role="form" action="{{url('/admin/System/adminLogs')}}">
            <div class="form-group">
              <input type="text" class="form-control" id="name" placeholder="按IP搜索" name='ip'>
            </div>
            <div class="form-group">
              <select class="form-control" name='type' >
                    <option value="">按类型搜索</option>
                    @foreach($type as $k => $v) 
                    <option value="{{$k}}">{{$v}}</option>
                    @endforeach
              </select>
            </div>
            <div class="form-group">  
                <div class='input-group date datetimepicker1' >  
                    <input type='text' class="form-control"  name='startDate' data-date-format="yyyy-mm-dd" readonly=""  placeholder="开始日期" />  
                    <span class="input-group-addon">  
                        <span class="glyphicon glyphicon-calendar"></span>  
                    </span>  
                </div>  
            </div>
            至
            <div class="form-group">  
                <div class='input-group date datetimepicker1'>  
                    <input type='text' class="form-control" name='endDate'  data-date-format="yyyy-mm-dd" readonly=""  placeholder="结束日期" />  
                    <span class="input-group-addon">  
                        <span class="glyphicon glyphicon-calendar"></span>  
                    </span>  
                </div>  
            </div>    
            <button type="submit" class="btn btn-success"><i class='glyphicon glyphicon-search'></i>搜索</button>
        </form>
      </div>
    <table class="table table-condensed table-bordered table-striped">
        <caption>前台日志</caption>
        <thead>
            <tr>
                <th>序号</th>
                <th>操作者</th>
                <th>类型</th>
                <th>操作内容</th>
                <th>IP</th>
                <th>时间</th>
            </tr>
        </thead>                
        <tbody>
            @foreach ($result as $k => $v) 
                <tr>
                    <td>{{ $k+1 }}</td>
                    <td>{{ $v['username'] }}</td>
                    <td>{{ $type[$v['type']] }}</td>
                    <td>{{ $v['content'] }}</td>
                    <td>{{ $v['IP'] }}</td>
                    <td>{{  date('Y-m-d H:i:s',$v['addtime']) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>
     {{ $result->appends(['ip' =>$ip,'type' => $ty, 'startDate' => $startDate ,'endDate' => $endDate])->links() }}
</div>
@endsection
@section('footer-js')
<script type="text/javascript">
    $(function () {  
    $('.datetimepicker1').datetimepicker({ 
        language:  'zh-CN' ,
        format:'yyyy-mm-dd',
        setDate: new Date(),
        weekStart: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0  
    });  
});  
</script>

@endsection
